﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using CLibArtreve.models;

namespace CLibArtreve.utilities
{
    public static class SessionHandler
    {
        public static bool isLoggedIn
        {
            get
            {
                if (HttpContext.Current.Session[SessionKeys.isLoggedIn] != null)
                {
                    return (bool)HttpContext.Current.Session[SessionKeys.isLoggedIn];
                }

                return false;
            }
            set { HttpContext.Current.Session[SessionKeys.isLoggedIn] = value; }
        }

        public static User UserInfo
        {
            get
            {
                if (HttpContext.Current.Session[SessionKeys.userData] != null)
                {
                    //SESSIONKEYS = session strings
                    return (User)HttpContext.Current.Session[SessionKeys.userData];
                }

                return null;
            }
            set { HttpContext.Current.Session[SessionKeys.userData] = value; }
        }
    }
}
